package cn.tedu;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class Demo9 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名:");
        String username = scanner.nextLine();
        System.out.println("请输入密码:");
        String password = scanner.nextLine();
        System.out.println("请输入昵称:");
        String nick = scanner.nextLine();
        try (
                Connection conn = DBUtils.getConn();
        ) {
            Statement s = conn.createStatement();
            s.executeUpdate("insert into user values (null,'"+username+"','"+password+"','"+nick+"')");
            System.out.println("执行完毕");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
